using System;

namespace SharpMud.Net
{
	/// <summary>
	/// Defines functionality for anything that sits and listens for INetworkConnection's
	/// </summary>
	public interface			IConnectionListener
	{
		/// <summary>
		/// The local IP endpoint that the connection listener is listening on
		/// </summary>
		System.Net.IPEndPoint	ListenPoint			{get;}
		/// <summary>
		/// The array of connections that have been attempted, but not recognized yet
		/// </summary>
		INetworkConnection[]	WaitingConnections	{get;}
		/// <summary>
		/// Removes a waiting connection from the list of attempted connections
		/// </summary>
		/// <param name="value">The connection to remove</param>
		void					RemoveWaitingConnection(INetworkConnection value);

		/// <summary>
		/// This event is raised when a connection attempt is made
		/// </summary>
		event ConnectionListenerEventHandler ConnectionMade;

		/// <summary>
		/// Tells the connection listener to start listening for connections
		/// </summary>
		void Start();
		/// <summary>
		/// Tells the connection listener to stop listening for connections
		/// </summary>
		void Stop();
	}
	
	/// <summary>
	/// The signature of a method that can handle an event raised by an IConnectionListener
	/// </summary>
	public delegate void ConnectionListenerEventHandler(IConnectionListener sender, INetworkConnection connection);
}